<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:p="http://primefaces.org/ui">

<ui:composition>
	<h:panelGrid columns="1" style="width:100%">
		<h:panelGrid id="productInfoPanel" columns="2" style="width:100%">
			<h:outputText value="Number" />
			<h:outputText value="#{productModel.current.number}" />
			<h:outputText value="Name" />
			<h:panelGrid columns="5">
				<h:outputText value="#{productModel.current.name}" />
				<h:outputText value="Chinese" />
				<h:outputText value="#{productModel.current.chineseName}" />
				<h:outputText value="French" />
				<h:outputText value="#{productModel.current.frenchName}" />
			</h:panelGrid>

			<h:outputText value="Supplier" />
			<h:panelGrid columns="2">
				<h:outputText
					value="#{productModel.current.supplier.name}  (#{productModel.current.supplier.address})  " />
			</h:panelGrid>

		</h:panelGrid>
		<p:commandButton value="Who buy it"
			actionListener="#{productController.loadWhoBuyItForCurrent}" update=":detailForm"
			ajax="true" style="float:right;background-color:orange"></p:commandButton>
		<p:separator></p:separator>
		<p:dataTable id="whoBuyItTable" var="who"
			value="#{productModel.current.whoBuyIts}" paginator="true" rows="10"
			rowsPerPageTemplate="5,7,10,15,20,30,40,50"
			paginatorTemplate="{CurrentPageReport}  {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}">
			<p:column sortBy="#{who.userId}">
				<h:outputText value="#{who.userId}" />
			</p:column>
			<p:column sortBy="#{who.userName}" filterBy="#{who.userName}"
				filterMatchMode="contains">
				<h:outputText value="#{who.userName}" />
			</p:column>
			<p:column sortBy="#{who.email}" filterBy="#{who.email}"
				filterMatchMode="contains">
				<h:outputText value="#{who.email}" />
			</p:column>
			<p:column sortBy="#{who.telephone}" filterBy="#{who.telephone}"
				filterMatchMode="contains">
				<h:outputText value="#{who.telephone}" />
			</p:column>
			<p:column sortBy="#{who.orderedQuantity}" headerText="Ordered Quantity">
				<h:outputText value="#{who.orderedQuantity}" />
			</p:column>
			<p:column sortBy="#{who.deliveredQuantity}" headerText="Delivered Quantity">
				<h:outputText value="#{who.deliveredQuantity}" />
			</p:column>

		</p:dataTable>
	</h:panelGrid>
</ui:composition>

</html>